<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8"/>
  <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
  <meta name="description" content="gym-management-system"/>
  <meta name="author" content="ZhangMing"/>
  <title>健身房管理系统-教练登录</title>
  <link href="/static/css/styles.css" th:href="@{css/styles.css}" rel="stylesheet"/>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/js/all.min.js"
          crossorigin="anonymous"></script>
  <script type="text/javascript">
    function checkSubmit(loginForm) {
      if (loginForm.coachId.value == '') {
        alert("请输入账号");
        loginForm.coachId.focus();
        return false;
      }
      if (loginForm.coachPassword.value == '') {
        alert("请输入密码");
        loginForm.coachPassword.focus();
        return false;
      }
      return true;
    }
  </script>

</head>
<body class="bg-primary" th:style="'background-image: url(/img/background.jpeg);background-size: 100%, 100%'">
<div id="layoutAuthentication">
  <div id="layoutAuthentication_content">
    <main>
      <div class="container">
        <div class="row justify-content-center">
          <div class="col-lg-5">
            <div class="card shadow-lg border-0 rounded-lg mt-5">
              <div class="card-header"><h3 class="text-center font-weight-light my-4">教练登录</h3></div>
              <div class="card-body">
                <form th:action="@{/coachLogin}" method="post" name="loginForm"
                      onsubmit="return checkSubmit(this)">
                  <div class="form-floating mb-3">
                    <input class="form-control" id="inputAccount" name="coachId" type="account"
                           placeholder="Account"
                           onkeypress="return event.keyCode>=48&&event.keyCode<=57"/>
                    <label for="inputAccount">账号</label>
                  </div>
                  <div class="form-floating mb-3">
                    <input class="form-control" id="inputPassword" name="coachPassword"
                           type="password"
                           placeholder="Password"/>
                    <label for="inputPassword">密码</label>
                  </div>
                  <div class="form-check mb-3">
                    <input class="form-check-input" id="inputRememberPassword" type="checkbox"
                           value=""/>
                    <label class="form-check-label" for="inputRememberPassword">记住密码</label>
                  </div>
                  <div class="d-flex align-items-center justify-content-between mt-4 mb-0">
                    <input type="submit" class="btn btn-success" value="登录">
                    <a class="btn btn-primary" th:href="@{/}">转到管理员登录</a>
                    <a class="btn btn-primary" th:href="@{/toUserLogin}">转到会员登录</a>
                  </div>
                </form>
                <div th:text="${msg}" style="margin-top: 20px;text-align: center;color: red"></div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </main>
  </div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
        crossorigin="anonymous"></script>
<script src="/static/js/scripts.js" th:src="@{js/scripts.js}"></script>
</body>
</html>
